//
//  AVSingleton.m
//  LastTemp
//
//  Created by apple on 15/4/22.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "AVSingleton.h"

@implementation AVSingleton


+(instancetype)shareSingleton
{
    static AVSingleton *avsingle = nil;
    if (avsingle == nil) {
        avsingle = [[AVSingleton alloc] init];
        avsingle.myBool = NO;

    }
    return avsingle;
}

-(void)AVPlayer:(NSString *)SongURL
{

    if (self.player.playing == NO) {
        NSString *strEncodeing = [SongURL stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
        NSURL *url = [NSURL URLWithString:strEncodeing];
        NSData *data = [NSData dataWithContentsOfURL:url];
        self.player = [[AVAudioPlayer alloc] initWithData:data error:nil];
        self.player.delegate = self;
        [self.player play];
    }else{
        [self.player stop];
        self.player = [[AVAudioPlayer alloc] init];NSString *strEncodeing = [SongURL stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
        NSURL *url = [NSURL URLWithString:strEncodeing];
        NSData *data = [NSData dataWithContentsOfURL:url];
        self.player = [[AVAudioPlayer alloc] initWithData:data error:nil];
        self.player.delegate = self;
        [self.player play];

    }
    [_player release];
    
}
- (void)dealloc
{
    [super dealloc];
    [_player release];
    [_fromArr release];
}

- (void)night
{
    [self.delegate changAlphNight];
}
- (void)day
{
    [self.delegate changAlphDay];
}


- (void)goPlyer
{
    [self.delegatePlay presentPlyer];
}

- (void)goTo
{
    [self.delegateApp goAp];
}

@end
